# encoding: utf-8
""" 
@version: v1.0 
@author: autumner 
@license: Apache Licence  
@contact: 18322313385@163.com 
@site:  https://gitee.com/autumner/pythoncookbook
@software: PyCharm 
@file: net_urllib_get.py
@time: 2019/7/10 上午11:01
"""
from urllib import request, parse

# 1.web中的get请求
url = 'http://httpbin.org/get'
# Base URL being accessed
params = {
    'name1' : 'value1',
    'name2' : 'value2'
}
# 提供get请求所需要的参数
querystring = parse.urlencode(params)
# 把参数转码为url标准格式
u = request.urlopen(url + '?' + querystring)
resp = u.read()
print(resp)
# 发送get请求并返回输出